﻿using GalaSoft.MvvmLight.Messaging;
using HuiZe.education.Common;
using HuiZe.education.Model;
using HuiZe.education.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace HuiZe.education.View
{
    /// <summary>
    /// Attendance.xaml 的交互逻辑
    /// </summary>
    public partial class Attendance : Window
    {
        public int kCID { get; set; }
        public AttendanceViewModel attend;
        private int RadioButtonValue=0;//0:出勤，1缺勤
        public Attendance()
        {
            InitializeComponent();

        }
        public Attendance(string kechengId)
        {
            InitializeComponent();
            kCID = Convert.ToInt32(kechengId);
            Loaded += Attendance_Loaded;
        }
        private void Attendance_Loaded(object sender, RoutedEventArgs e)
        {

            attend = DataContext as AttendanceViewModel;
            attend.kcgd(kCID);
        }

        /// <summary>
        /// 出勤
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void YcbSubmitbtn_Click(object sender, RoutedEventArgs e)
        {
            attend.EditStudentLog(RadioButtonValue);
        }

        private void txtPrevious_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            attend.DelUserInfo();
        }

        private void txtNext_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
          
            attend.AddUserInfo();
        }

        private void CommonTitle_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            this.DragMove();
        }


        private void Border_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {

        }


        private void yjkqBorder_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            attend.StudentoneCheck();
        }

        private void xsmdBorder_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            CourseShowView courModel = new CourseShowView(attend.attList()); //CourseShowView.GetCourseShowInfo();//展示用户列表
            courModel.ShowDialog();
        }

        private void chuqin_Checked(object sender, RoutedEventArgs e)
        {
            RadioButtonValue = 1;
        }

        private void queqin_Click(object sender, RoutedEventArgs e)
        {
            RadioButtonValue = 2;
        }
    }
}
